package com.xmut.mapper;

import com.xmut.pojo.ManagerSet;
import com.xmut.pojo.OldMan;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface OldManMapper {

    //获得所有老人信息
    @Select("select * from oldman")
    List<OldMan> getList();

    //删除某个老人信息
    @Delete("delete from oldman where id = #{id}")
    void oldManDel(Integer id);

    //新增一个老人
    @Insert("insert into oldman(name,age,gender,entrydate,managerid) values (#{name},#{age},#{gender},#{entrydate},#{managerid})")
    void oldManIns(OldMan oldMan);


    //修改老人的信息
    @Update("update oldman set name = #{name},age = #{age},gender = #{gender},temperature = #{temperature},bloodpressure = #{bloodpressure},heartrate = #{heartrate},state = #{state},disease = #{disease} where id = #{id}")
    void oldManUpd( OldMan oldMan);

    //根据id来获得老人的信息
    @Select("select * from oldman where id = #{id}")
    OldMan getById(Integer id);

    @Select("select * from oldman where managerid = #{id}")
    List<OldMan> getByManagerId(Integer id);

    @Select("select * from t_managerset where id = #{managerid}")
    ManagerSet getManagerSet(Integer managerid);

    @Update("update t_managerset set temperdown = #{temperdown}, temperup = #{temperup},blooddown = #{blooddown},bloodup = #{bloodup},heartdown = #{heartdown},heartup = #{heartup} where id = #{managerid}")
    void setManaSet(ManagerSet managerSet);

    @Update("update oldman set evaluate = #{evaluate} where id = #{id}")
    void setEvaluate(Integer id, String evaluate);
}
